package cn.bdqn.service.impl;

import cn.bdqn.domain.Address;
import cn.bdqn.mapper.AddressMapper;
import cn.bdqn.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 行政划区实现类
 * @author dkj
 */
@Service("addressService")
public class AddressServiceImpl implements AddressService {


    /**
     * //行政划区接口
     */
    @Autowired
    private AddressMapper addressMapper;
    /**
     * 查询父级数据
     * @return
     */
    @Override
    public List<Address> queryAllParent() {
        //查询全部父级元素
        return addressMapper.selectAllParent();
    }

    /**
     * 根据父级id查询子级数据
     * @param parentId
     * @return
     */
    @Override
    public List<Address> queryByParentId(Integer parentId) {
        //根据父级id查询子级元素
        return addressMapper.selectByParentId(parentId);
    }

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Override
    public Address queryByAddressId(Integer id) {
        //根据id查询
        return addressMapper.selectByPrimaryKey(id);
    }
}
